package com.xiyuan.smartutils.client.ws.core;

import com.xiyuan.smartutils.client.exception.WebSocketException;
import com.xiyuan.smartutils.constants.AsciiConstants;

import java.io.IOException;

/**
 * WebSocketClient
 *
 * @author xiyuan-lgz 2024-10-31 @version v1.0.0 新建与整理
 */
public interface IWebSocketClient extends AsciiConstants {
    
    /**
     * Connect.
     *
     * @throws WebSocketException the web socket exception
     * @throws IOException        Signals that an I/O exception has occurred.
     */
    public void connect() throws WebSocketException, IOException;
    
    /**
     * Checks if is connected.
     *
     * @return true, if is connected
     */
    public boolean isConnected();
    
    
    /**
     * Checks if is blocking mode.
     *
     * @return true, if is blocking mode
     */
    public boolean isBlockingMode();
    
    /**
     * Sets the blocking mode.
     *
     * @param blockingMode the new blocking mode
     */
    public void setBlockingMode(boolean blockingMode);
    
    /**
     * Gets the connection timeout(seconds).
     *
     * @return the connection timeout
     */
    public int getConnectionTimeout();
    
    /**
     * Sets the connection timeout(seconds).
     *
     * @param connectionTimeout the new connection timeout
     */
    public void setConnectionTimeout(int connectionTimeout);
    
    /**
     * Gets the connection timeout(seconds).
     *
     * @return the connection timeout
     */
    public int getConnectionReadTimeout();
    
    /**
     * Sets the connection timeout(seconds).
     *
     * @param timeout the new connection timeout
     */
    public void setConnectionReadTimeout(int timeout);
    
    /**
     * Gets the buffer size.
     *
     * @return the buffer size
     */
    public int getBufferSize();
}
